//
//  GameZXTableView.m
//  GameBaby
//
//  Created by keyZhang on 14-1-9.
//  Copyright (c) 2014年 keyZhang. All rights reserved.
//

#import "GameZXTableView.h"
#import "GameZXTableViewCell.h"
#import "WebShowViewController.h"

@implementation GameZXTableView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifier = @"zxTbViewCell";
    GameZXTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"GameZXTableViewCell" owner:self options:nil] lastObject];
    }
    cell.model = self.dataList[indexPath.row];
    return cell;
}



- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    WebShowViewController *wbVC = [[WebShowViewController alloc] init];
    wbVC.linkURL = [(ZXCellModel *)self.dataList[indexPath.row] url] ;
    if (tableView.tag == 20) {
        wbVC.contentTitle = @"游戏资讯";
    }else if (tableView.tag == 30)
    {
        wbVC.contentTitle = @"游戏攻略";
    }
    [self.viewController.navigationController pushViewController:wbVC animated:YES];
}


@end
